copy one array to another using copyOf method in java